package com.example.understand_compose1.fet_mapsdk

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.baidu.mapapi.SDKInitializer
import com.baidu.mapapi.map.BaiduMap
import com.baidu.mapapi.map.BaiduMapOptions
import com.baidu.mapapi.map.MapStatus
import com.baidu.mapapi.map.MapStatusUpdate
import com.baidu.mapapi.map.MapStatusUpdateFactory
import com.baidu.mapapi.map.MapView
import com.example.understand_compose1.R

// NOTE: 提供一个百度地图的例子
// 1. 卫星地图
// 2. 缩放地图
class FetBaiduMapActivity : AppCompatActivity() {
    private var mMapView: MapView? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        enableEdgeToEdge()
        setContentView(R.layout.activity_fet_baidu_map)

        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }


        mMapView = findViewById<MapView>(R.id.bmapView)
        // 卫星地图
        mMapView!!.map.mapType = BaiduMap.MAP_TYPE_SATELLITE

        // 设置缩放级别
        val bd = MapStatus.Builder()
        bd.zoom(18.0f)
        mMapView!!.map.setMapStatus(MapStatusUpdateFactory.newMapStatus(bd.build()))

    }
}